<template>
  <section>
    <div style="margin:0px auto;width:760px;background:#ddd;text-align:center;border: 1px solid #ddd">
  <div style="margin-top:20px;">
    <span>送鉴用户：</span>{{user}}<span class="nickname" style="margin-right: 20px"></span>
    <span>品类：</span>{{category}}<span class="category" style="margin-right: 20px"></span>
    <span>鉴定专家：</span>{{expert}}<span class="zhuanjia"></span>
  </div>
    <div style="padding-top:10px">
      <h4>专家回复</h4>
      <div id="exprotRplay" style="text-align:left;margin-top:10px;padding:0 30px;">
        {{replyText}}
      </div>
    </div>
    <div style="padding-top:10px">
      <h4>鉴赏信息</h4>
      <div id="appreciateInfo" style="text-align:left;margin-top:10px;padding:0 30px;">
        {{description}}
      </div>
    </div>
    <div style="padding-top:10px">
      <h4>鉴赏图片</h4>
      <div id="imgShow" v-if='img.length!==0' style="text-align:left;margin-top:10px;padding:0 30px 30px;">
        <img v-for="(item,index) in img" style="width: 100%" :src='item.url' alt="永福鉴赏图片" @click="$preview.open(index, img)">
      </div>
    </div>
    </div>
  </section>
</template>
<script>
  import { sendData,cutString } from "../../api/api";
  export default {
    data() {
      return {
        id:"",
        category:"",
        expert:"",
        user:"",
        replyText:"",
        description:"",
        img:[]
      }
    },
    created(){
        this.getparam()
        
    },
    methods: {
      //查看鉴赏详情 获取路由参数或更新并存储用于刷新
       getparam:function(){
        let id=parseInt(sessionStorage.getItem("JS_ID"))
        let category=sessionStorage.getItem("category")
        let expert=sessionStorage.getItem("expert")
        if (id) {
          if (this.$route.params.id&&id!==this.$route.params.id) {
            sessionStorage.setItem("JS_ID",this.$route.params.id)
              this.id=this.$route.params.id
              this.category=this.$route.params.category
              this.expert=this.$route.params.expert
          }else{
            this.id=id
            this.category=category
            this.expert=expert
          }
        }else{
        sessionStorage.setItem("JS_ID",this.$route.params.id)
        sessionStorage.setItem("category",this.$route.params.category)
        sessionStorage.setItem("expert",this.$route.params.expert)
          this.id=parseInt(sessionStorage.getItem("JS_ID"))
          this.category=sessionStorage.getItem("category")
          this.expert=sessionStorage.getItem("expert")
      }
    },
      //获取用户鉴赏详情
      getappreciateInfo: function () {
        let params=sendData({url: "appraisal/info",msg: {id:this.id}})
        this.$http.get(params.baseURL,{params:params.params}).then(res=>{
          var res=cutString(res.bodyText)
          console.log(res)
          this.user=res.msg.nickname
          this.img=res.msg.imgList
          this.replyText=res.msg.replyText
          res.msg.description==""?this.description="用户没有填写描述":this.description=res.msg.description
        })
      }
      
  },
    
    mounted() {
      this.getappreciateInfo();
    }
  };

</script>

<style scoped>

</style>